<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Account
 *
 * @property int $id 账户ID
 * @property int $user_id 用户ID
 * @property int $coin_id 币种ID
 * @property float|null $available 可用余额
 * @property float|null $disabled 冻结余额
 * @property float|null $freeze 待释放USDT
 * @property int $version 版本号
 * @property-read \App\Models\Coin|null $coin
 * @property-read \App\Models\User $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereAvailable($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereCoinId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereDisabled($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereUserId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Account whereVersion($value)
 * @mixin \Eloquent
 */
class Account extends Model
{
    public $type;
    public $action_id;

    use AccountLogHelper;

    public $timestamps = false;

    protected $table = 'accounts';

    protected $fillable = ['coin_id', 'user_id'];

    public function coin()
    {
        return $this->hasOne(Coin::class, 'id', 'coin_id');
    }

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
